﻿using Apache.Ibatis.DataMapper;
using Apache.Ibatis.DataMapper.Configuration;

namespace ZxdFramework
{
    /// <summary>
    /// 框架的工厂类, 提供了组装框架中需要用到的各种功能整合. 用户在使用前必须先进行工厂类的初使化工作.
    /// </summary>
    public class FrameworkFactory
    {
        private IMapperFactory _mapperFactory;

        /// <summary>
        /// 私有化的构造函数. 
        /// </summary>
        private FrameworkFactory()
        {
            var builder = new DefaultConfigurationEngine();
            _mapperFactory = builder.BuildMapperFactory();
            
        }

        private static FrameworkFactory _factory;

        /// <summary>
        /// 获取工厂类的实例
        /// </summary>
        public static FrameworkFactory Instance
        {
            get
            {
                if(_factory == null) _factory = new FrameworkFactory();
                return _factory;
            }
        }

        /// <summary>
        /// 
        /// </summary>
         protected void Init()
         {
             
         }
    }
}